<template>
    <div class="boss">
        <div class="box">
            <label for="checkall" class="lab">
                <input type="checkbox" name="checkall" v-model="flag" @change="allChecked" />全选
            </label>
            <el-button type="info" @click="deleAll">批量删除</el-button>
        </div>
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="currentPage1"
            :page-size="pagesize"
            layout="prev, pager, next, jumper"
            :total="leng"
        ></el-pagination>
    </div>
</template>

<script>
import eventBus from "../../../utils/eventBus";
export default {
    props: ["leng", "pagesize", "page"],
    methods: {
        deleAll() {
            eventBus.$emit("deleAll");
        },
        allChecked() {
            eventBus.$emit("checks", this.flag);
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
        },
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
            console.log(this.leng, "sssss");
            this.$emit("thispage", val);
            // eventBus.$emit("pagetime");
        },
    },
    data() {
        return {
            flag: false,
            currentPage1: 1,
        };
    },
};
</script>

<style lang="less" scoped>
.boss {
    text-align: center;
    .lab {
        font-weight: 600;
        font-size: 14px;
        margin-right: 15px;
        margin-top: 14px;
    }
    .box {
        float: left;
    }
}
</style>